function send(params) {
  var msd = {
    appid: 't251', // 商户分配的 appid
    timestamp: '1504495600',// parseInt(new Date() / 1000), // 商户发起授权请求时的时间戳(以秒为单位的10位时间戳)
    user_id: 'any', // 商户用户ID
    user_client_ip: '110.167.157.199', // 商户用户IP
    app_secret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  };
  msd.request_sign = signature(msd); // 'a705fddf9cad3306b71d5c1098d97f39af5628d8'; // 商户授权接口时的参数摘要将appid、timestamp、userid、user_client_ip、app_secret五个参数通过4. signature 计算方法得到的加密字符串
  msd.warrant_available = 7200; // 授权ID有效期，单位：s

  // msd = {
  //   applicationId: "1459219202000001",
  //   clientId: "",
  //   connect_id: "41d7a2b53d7cc080f6ae2866237118c8",
  //   sig: "a705fddf9cad3306b71d5c1098d97f39af5628d8",
  //   timestamp: "1504495600",
  //   userId: "any",
  // }

  $.ajax({
    type: "POST",
    dataType: 'json',
    url: 'http://trial.cloud.ssapi.cn:8080/auth/authorize',
    data: jsToFormData(msd),
    success: function (data, status) {
      console.log(data, status)
      console.log(arguments);
    },
    error: function (data) {
      // console.log(msd);
      console.log(arguments)
    }
  });
}
function obj2arr(params) {
  var keys = Object.keys(params);
  let key = '';
  let val = '';
  let ret = [];
  for (let i = 0; i < keys.length; i++) {
    key = keys[i];
    val = params[key];
    if (typeof val == 'object') {
      ret = ret.concat(obj2arr(val));
    } else {
      ret.push(key + '=' + val);
    }
  }
  return ret;
}
function signature(params) {
  // return 'a705fddf9cad3306b71d5c1098d97f39af5628d8';
  var ret = obj2arr(params).sort().join('&');
  return md5(ret);
}
var md = {
  applicationId: "1459219202000001",
  timestamp: "1504495600",
  userId: "any",
}
// console.log(signature(md));
// sig: "a705fddf9cad3306b71d5c1098d97f39af5628d8",
function jsToFormData(params) { //对象转formdata格式
  let ret = $('#form');
  ret = new FormData(ret[0]);
  var keys = Object.keys(params);
  let key = '';
  let val = '';
  for (let i = 0; i < keys.length; i++) {
    key = keys[i];
    val = params[key];
    ret.append(key, val);
  }
  return ret;
}
var msd = {
  appid: 't251', // 商户分配的 appid
  timestamp: '1504495600',// parseInt(new Date() / 1000), // 商户发起授权请求时的时间戳(以秒为单位的10位时间戳)
  user_id: 'any', // 商户用户ID
  user_client_ip: '110.167.157.199', // 商户用户IP
  app_secret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
};
msd.request_sign = signature(msd); // 'a705fddf9cad3306b71d5c1098d97f39af5628d8'; // 商户授权接口时的参数摘要将appid、timestamp、userid、user_client_ip、app_secret五个参数通过4. signature 计算方法得到的加密字符串
msd.warrant_available = 7200; // 授权ID有效期，单位：s


// send();